unitallinmap = 0
function CreateUnit(keys)
	local unit = CreateUnitByName(keys.unit_name, keys.caster:GetOrigin(), true, keys.caster,keys.caster, keys.caster:GetTeam())
	--print(keys.caster,keys.caster:GetPlayerOwnerID())
	unit:SetOwner(keys.caster)
	unit._playerID = keys.caster:GetPlayerOwnerID()
	--print("unit",unit:GetPlayerOwnerID())
	--unit:SetPlayerID(keys.caster:GetPlayerOwnerID())
	local ability = keys.ability
	local player = PlayerResource:GetPlayer(keys.caster:GetPlayerOwnerID())
	if player.unit_spawner ~= nil then table.insert(player.unit_spawner,unit) end
	keys.caster:CastAbilityNoTarget(ability, keys.caster:GetPlayerOwnerID())
	unitallinmap = unitallinmap + 1
	print("AllUnitsInMap: "..unitallinmap)
end